package com.ktgj.hotel.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.hotel.domain.HotelOrderFlowstatus;
import com.ktgj.hotel.service.IHotelOrderFlowstatusService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 * 
 * @author ruoyi
 * @date 2022-01-06
 */
@RestController
@RequestMapping("/flowstatus")
public class HotelOrderFlowstatusController extends BaseController
{
    @Autowired
    private IHotelOrderFlowstatusService hotelOrderFlowstatusService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize(hasPermi = "hotel:flowstatus:list")
    @GetMapping("/list")
    public TableDataInfo list(HotelOrderFlowstatus hotelOrderFlowstatus)
    {
        startPage();
        List<HotelOrderFlowstatus> list = hotelOrderFlowstatusService.selectHotelOrderFlowstatusList(hotelOrderFlowstatus);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize(hasPermi = "hotel:flowstatus:export")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HotelOrderFlowstatus hotelOrderFlowstatus) throws IOException
    {
        List<HotelOrderFlowstatus> list = hotelOrderFlowstatusService.selectHotelOrderFlowstatusList(hotelOrderFlowstatus);
        ExcelUtil<HotelOrderFlowstatus> util = new ExcelUtil<HotelOrderFlowstatus>(HotelOrderFlowstatus.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize(hasPermi = "hotel:flowstatus:query")
    @GetMapping(value = "/{orderflowid}")
    public AjaxResult getInfo(@PathVariable("orderflowid") Long orderflowid)
    {
        return AjaxResult.success(hotelOrderFlowstatusService.selectHotelOrderFlowstatusById(orderflowid));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize(hasPermi = "hotel:flowstatus:add")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HotelOrderFlowstatus hotelOrderFlowstatus)
    {
        return toAjax(hotelOrderFlowstatusService.insertHotelOrderFlowstatus(hotelOrderFlowstatus));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize(hasPermi = "hotel:flowstatus:edit")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HotelOrderFlowstatus hotelOrderFlowstatus)
    {
        return toAjax(hotelOrderFlowstatusService.updateHotelOrderFlowstatus(hotelOrderFlowstatus));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize(hasPermi = "hotel:flowstatus:remove")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{orderflowids}")
    public AjaxResult remove(@PathVariable Long[] orderflowids)
    {
        return toAjax(hotelOrderFlowstatusService.deleteHotelOrderFlowstatusByIds(orderflowids));
    }

    /**
     * 酒店订单查询条件订单流程状态
     * */
    @PostMapping("/selectHotelOrderFlowstatus")
    public AjaxResult selectHotelOrderFlowstatus() {
        List<HotelOrderFlowstatus> hotelOrderFlowstatuses = hotelOrderFlowstatusService.selectHotelOrderFlowstatus();
        return AjaxResult.success(hotelOrderFlowstatuses);
    }
}
